<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">

<body>
<div th:fragment="navigation">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<!--                    <span class="sr-only">CJ社区</span>-->
                </button>
                <a class="navbar-brand" href="/">CJ社区</a>
            </div>
<!--            搜索框 ，把search传给index-->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <form class="navbar-form navbar-left" action="/" method="get">
                    <div class="form-group">
                        <label>
                            <input type="text" class="form-control" name="search" placeholder="搜索问题">
                            <button type="submit" class="btn btn-default">搜索</button>
                        </label>
                    </div>
                </form>
<!--                导航栏右边内容-->
                <ul class="nav navbar-nav navbar-right">
<!--                    session中没有user信息的话不能发布-->
                    <li th:if="${session.user != null}">
                        <a href="/publish">发布</a>
                    </li>
                    <li><a href="/profile/replies">通知 <span class="badge" th:text="${session.unreadCount}"></span></a></li>

                    <li class="dropdown" th:if="${session.user != null}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">
                            <span th:text="${session.user.getName()}"></span>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="/profile/questions">消息中心</a></li>
                            <li><a href="/logout">退出登录</a></li>
                        </ul>
                    </li>
                    <li th:if="${session.user == null}">
                        <a th:href="@{https://gitee.com/oauth/authorize(client_id='326538af87a7283fca31d850255e9f40050baad43143aa714a6161de36327b7e',redirect_uri=${'http://www.considinej.co/callback'},response_type=code,state=1)}">登录</a>
<!--                        <a href="https://gitee.com/oauth/authorize?client_id=326538af87a7283fca31d850255e9f40050baad43143aa714a6161de36327b7e&redirect_uri=http://localhost:8887/callback&response_type=code&state=1">登录</a>-->
<!--                        <a href="https://gitee.com/oauth/authorize?client_id=326538af87a7283fca31d850255e9f40050baad43143aa714a6161de36327b7e&redirect_uri=http://117.50.175.226/callback&response_type=code&state=1">登录</a>-->
<!--                        https://gitee.com/oauth/authorize?client_id=326538af87a7283fca31d850255e9f40050baad43143aa714a6161de36327b7e&redirect_uri=http://localhost:8887/callback&response_type=code&state=1-->
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</div>
</body>
</html>